Skip to content

feat: add Stack Overflow and Medical causal-LM applications - #31

Open
soomro-abd wants to merge 1 commit into
feat/finance-causal-lmfrom
feat/stackoverflow-medical-causal-lm
Open

soomro-abd wants to merge 1 commit into
feat/finance-causal-lmfrom
feat/stackoverflow-medical-causal-lm

Conversation

@soomro-abd

Copy link
Copy Markdown
Collaborator

Stack Overflow needs user-partitioned next-token training, while Medical needs free-text instruction tuning and memory-bounded effective batches. This adds both applications to FLTest's Flower causal-LM lifecycle, with task-specific evaluation, poisoning and membership probes.

Depends on #30. The base is feat/finance-causal-lm so this diff contains only the new applications and their shared changes. Retarget to main after #30 merges.

Changes

  • Add deterministic Stack Overflow SQLite-to-Parquet export, disjoint train/held-out users, one user per client, full-model parameter transport with tied-weight preservation, next-token accuracy, perplexity and full-model checkpoints.
  • Add Medical flashcard IID shards with grouped question holdouts, recorded exclusions for empty records, response-only loss, and a pinned PubMedQA fold-0 test subset using FlowerTune's prompt format. Record subset IDs, truncation and evaluation deviations.
  • Support token-weighted gradient accumulation for effective batches, preserving successful-step sample IDs and legacy run identities. Expose explicit SDPA attention for Qwen: eager FP16 attention produced nonfinite round-0 output, while SDPA passed the same-input diagnostic and subsequent training checks.
  • Add Stack Overflow target-word and Medical fixed-answer backdoors, plus user-level and per-sample membership probes respectively. Preserve clean records and measure held-out ASR.
  • Bound full-model robust aggregation and MPC memory, guard FLDetector driver-memory requirements, free decoded wire copies, and discover stable client IDs concurrently for large virtual cohorts.
  • Add configurations, application guides, optional LM CPU CI coverage and regression tests.

Validation

  • Full Linux/Python 3.11 suite: 239 passed, 1 skipped (optional NVFlare). Tests include real local LoRA/full-model training, tied embeddings, token-weighted accumulation versus an unsplit optimizer step, data isolation, poisoning, privacy probes and Qwen SDPA.
  • Stack Overflow: 14 GPU integration scenarios passed on two Quadro RTX 6000 nodes. The SmolLM2-360M packing check selected eight clients from 1,000 users, four per GPU. Verified actual row ownership, held-out-user separation, membership probe counts and checkpoint artifacts; representative 135M/360M full-model checkpoints reloaded successfully.
  • Medical: 14 GPU integration scenarios passed, including SmolLM2 clean/attack/defense checks and Qwen2.5-7B one-round memory and two-round training checks. Qwen used effective batch 16, micro-batch 4 and four accumulation steps; maximum sampled whole-job GPU memory was 19,424 MiB. Both model sizes' adapters reloaded with exact saved weights and finite forward passes.
  • Audited secure-aggregation cancellation and fixed-point overflow/error diagnostics. Source consistency verified on both nodes, strict MkDocs build and git diff --check passed, and Ray was stopped after validation.

These short runs establish integration, not attack/defense efficacy or leaderboard-level model quality. Medical PubMedQA uses four or eight evaluation examples; GPU memory figures use the actual dynamically padded smoke records.

Follow-ups

Full grids and repeated seeds, longer clean learning checks, 64-participant/10,000-user Stack Overflow scaling, 20-client/four-participant Medical validation, Finance leaderboard evaluation, cosine learning-rate scheduling, learning-gap warnings, LM reference parity, GPU repeatability and resumable checkpoints remain separate work. LoRA is implemented; DoRA is optional. Secure aggregation is a simulation and gradient noise has no privacy accountant.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant